/*
*
**/

import 'dart:async';

import 'package:flutter/material.dart';

class Page1 extends StatefulWidget {

  Page1({Key? key}):super(key:key);

  @override
  State createState() => Page1State();
}

class Page1State extends State<Page1>  with AutomaticKeepAliveClientMixin{

  @override
  void initState() {
    super.initState();
    print("Page 1 init");
    updateData();
  }

  @override
  void didUpdateWidget(covariant Page1 oldWidget) {
    super.didUpdateWidget(oldWidget);
    print('didUpdateWidget');
  }

  @override
  void didChangeDependencies() {
    super.didChangeDependencies();
    print('didChangeDependencies');
  }

  bool _updating = false;

  updateData(){
    print('updateData-page1');
    setState(() {
      _updating = true;
    });
   Timer(Duration(seconds: 3),(){
     setState((){
       _updating = false;

     });
   });
  }

  @override
  Widget build(BuildContext context) {
    super.build(context);
    return  Column(
      children: [
        Text("Page 1"),
        _updating?CircularProgressIndicator(color:Colors.blue):SizedBox.shrink(),
      ],
    );
  }

  @override
  bool get wantKeepAlive => true;

}